#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>

int main()
{
    int N, i, delete, cnt = 0;
    scanf("%d", &N);
    int arr[50];
    for (i = 0; i < N; i++)
    {
        scanf("%d", &arr[i]);
    }
    scanf("%d", &delete);
    for (i = 0; i < N; i++)
    {
        while (arr[i] == delete)
        {
            cnt++;
            int j = 0;
            for (j = i; j < N; j++)
            {
                arr[j] = arr[j + 1];
            }
        }
    }
    for (i = 0; i < N - cnt; i++)
    {
        printf("%d ", arr[i]);
    }
    return 0;
}